split param-string by escaping brackets to allow for type containing brackets#25
split param-string by escaping brackets to allow for type containing brackets#25louisdecharson wants to merge 1 commit into
Conversation
|
I don't think it will work since it will affect all other languages. Python is indeed one of the hardest languages to parse using regex. 😓 Another approach is ts-docstr, but it requires tree-sitter. The parsing task is a lot easier there, and it's fast and accurate. Here is the result from def foo(bar: Dic[str, Dict[str, str]]) -> Dict[str, Dict[str, str]]:
"""
Parameters
-------
bar : Dic[str, Dict[str, str]]
[description]
Returns
-------
[description]
"""
pass |
|
Hi @jcs090218, thank you for the swift reply. Happy to use |
I don't have an example in mind. Let me re-think this, and then I will get back to you!
|
Types in Python might contain brackets and commas resulting in errors when parsing the parameters of the function.
Example
Results in

The PR creates a new function

docstr--split-string-escape-bracketsthat split string while escaping the bracket to capture the full type: